home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1999-06-16 | 7.2 KB | 322 lines |
- G4C
-
- ; FILEREQ.GC
- ; A multiselect File Requester with Favourites etc..
-
- ; GuiLoad guis:tools/filereq.gc GuiName Routine Path FavFile -or
- ; GuiOpen filereq.gc GuiName Routine Path FavFile
-
- ; GuiName - Name of your gui
- ; Routine - Routine in your gui that will be called
- ; Path - (optional) path to open at - if you want..
- ; FavFile - (optional) name of the Favourites file
-
- ; ====================================================================
-
- ; Globals
-
- ; ====================================================================
-
- WINBIG 185 16 291 213 'Choose file(s) :'
- WinType 11110001
- varpath ''
-
- BOX 0 0 291 213 in icondrop
-
-
- ; ====================================================================
-
- ; System events
-
- ; ====================================================================
-
- xONLOAD gui routine path favfile
- if $gui > '' ; dont pass them if you just want to load it.
- and $routine > ''
- guiopen filereq.gc $gui $routine $path $favfile
- endif
-
- xONRELOAD gui routine path favfile
- guiopen filereq.gc $gui $routine $path $favfile
-
-
- XONOPEN gui routine path favfile
- setgad filereq.gc 52/53 off
- if $path > ''
- lvuse filereq.gc 1
- LVDir '#$path'
- update filereq.gc 2 $$lv.dir
- endif
- if $favfile = ""
- favfile = guis:tools/fav/default
- endif
-
-
- xOnRMB
- if $mode = FAV
- setgad filereq.gc 52/53 off
- setgad filereq.gc 2/16 on
- setgad filereq.gc 50/51 on
- lvuse filereq.gc 1
- lvmode DIR
- lvdir #$$lv.dir
- mode = ''
- else
- guiopen FileReq2 ; open the pop-up gui (end of this file)
- endif
-
- xOnQuit
- guiquit FileReq2
-
-
- ; ====================================================================
-
- ; The Listview
-
- ; ====================================================================
-
- XLISTVIEW 9 5 213 190 "" filename "" 10 DIR
- GADID 1
- GADFONT #mono 8 000
- if $mode = FAV
- setgad filereq.gc 52/53 off
- setgad filereq.gc 2/16 on
- setgad filereq.gc 50/51 on
- mode = ''
- lvmode DIR
- lvdir #$filename
- else
- guiclose filereq.gc
- gosub $gui $routine $filereq.gc/filename ; Give FULL variable path!
- endif
-
-
- ; directory hook
- xlvdirhook 1
- update filereq.gc 2 $filename
-
-
- ; single click hook
- xlvhook 1
- update filereq.gc 2 $filename
-
-
- XTEXTIN 9 194 273 14 "" txtfile "" 100
- GADID 2
- gadhelp 'Shows file chosen - Change the name & hit enter, to Rename it'
- ifexists file $txtfile
- guiclose filereq.gc
- gosub $gui $routine $filereq.gc/filename
- else
- ezreq 'Rename $filename\nto $txtfile ?' Rename|CANCEL choice
- if $choice = 1
- rename $filename $txtfile
- lvuse filereq.gc 1
- lvdir refresh
- endif
- endif
-
-
- ; ====================================================================
-
- ; Listview control buttons
-
- ; ====================================================================
-
- XBUTTON 224 5 58 14 "Parent"
- gadid 10
- gadhelp 'CD to Parent of current dir'
- lvuse filereq.gc 1
- LVDir parent
- update filereq.gc 2 $$lv.dir
-
-
- XBUTTON 224 19 58 14 "Root"
- gadid 11
- gadhelp 'CD to Root of current dir'
- lvuse filereq.gc 1
- LVDir root
- update filereq.gc 2 $$lv.dir
-
-
- XBUTTON 224 33 58 14 "Disks"
- gadid 12
- gadhelp 'Show device list'
- lvuse filereq.gc 1
- LVDir disks
- update filereq.gc 2 $$lv.dir
-
-
- XBUTTON 224 47 58 14 "All"
- gadid 13
- gadhelp 'Select all items'
- lvuse filereq.gc 1
- LVDir all
- update filereq.gc 2 $$lv.dir
-
-
- XBUTTON 224 61 58 14 "None"
- gadid 14
- gadhelp 'Unselect all items'
- lvuse filereq.gc 1
- LVDir none
- update filereq.gc 2 $$lv.dir
-
- ; ====================================================================
-
- ; Copy & delete
-
- ; ====================================================================
-
- XBUTTON 224 92 58 14 ""
- gadid 14
-
- XBUTTON 224 78 58 14 ""
- gadid 14
-
- XBUTTON 224 106 58 14 "MkDir"
- gadid 16
- gadhelp 'Create directory named $txtfile'
- guiclose filereq.gc
- ifexists dir $txtfile
- orifexists file $txtfile
- ezreq 'ERROR: Invalid directory name.\n\nEnter valid name for directory\nin the TxtIn gadget and try again..' OK ''
- else
- makedir $txtfile
- lvdir #$txtfile
- update filereq.gc 2 $filename
- endif
-
-
- ; ====================================================================
-
- ; Favourites control
-
- ; ====================================================================
-
- XBUTTON 224 123 58 14 "Fav"
- gadid 50
- gadhelp 'Shows Favourites listing ($favfile\)'
- setgad filereq.gc 2/16 off
- setgad filereq.gc 50/51 off
- setgad filereq.gc 52/53 on
- lvuse filereq.gc 1
- lvmode MULTI
- lvchange $favfile
- lvsort asc
- mode = FAV
-
-
- XBUTTON 224 137 29 14 "+" ; add to favourites
- gadid 51 ; create file if it doesn't exist
- gadhelp 'Add current dir to Favourites'
- ifexists file $favfile
- ; ok
- else
- .dummy = 'GUIs:' ; got to have this one :)
- copy env:.dummy $favfile
- endif
- lvuse filereq.gc 1
- append $favfile '\n$$lv.dir'
-
-
- XBUTTON 253 137 29 14 "-" ; delete from favourites
- gadid 52
- gadhelp 'Deleted selected favourites entries'
- lvuse filereq.gc 1
- lvmulti first
- while $filename > ''
- lvdel -1
- lvmulti first ; since we deleted the old 1st one
- endwhile
-
-
- XBUTTON 224 151 58 14 "Save" ; save favourites
- gadid 53
- gadhelp 'Save Favourites as $favfile'
- lvuse filereq.gc 1
- lvsave $favfile
-
- ; ====================================================================
-
- ; OK & Cancel
-
- ; ====================================================================
-
- XBUTTON 224 168 58 25 "OK"
- gadid 15
- gadhelp 'Selected files will be sent to calling gui'
- guiclose filereq.gc
- lvuse filereq.gc 1
- lvmulti first
- while $filename > ''
- gosub $gui $routine $filereq.gc/filename
- lvmulti off
- lvmulti next
- endwhile
-
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- ; ====================================================================
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- ; Pop - up gui
-
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- ; ====================================================================
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- NewFile FileReq2
-
- WinBig 0 0 80 105 ""
- WinType 00001000
- winonmouse 30 10
-
- xOnRMB
- guiclose #this
-
- xOnInactive
- guiclose #this
-
- xBefore
- guiclose #this
-
- ; -------------------- buttons
-
- xbutton 0 0 80 15 "Search"
- gadhelp 'Load the Search.gc gui'
-
- lvuse filereq.gc 1
- path = $$lv.dir
- if $path < ' '
- path = sys:
- endif
- guiload guis:g4c/fsearch/fsearch.gc $filereq2/path
-
- xbutton 0 15 80 15 'Copy'
- gadhelp 'Copy selected files (destination chosen through requester)'
- dest = ''
- ReqFile -1 -1 300 -40 'Choose destination:' DIR dest ''
- if $dest > ' '
- lvuse filereq.gc 1
- lvaction copy $dest
- endif
-
- xbutton 0 30 80 15 'Delete'
- gadhelp 'Delete selected files'
- lvuse filereq.gc 1
- lvaction delete REQ
-
- xbutton 0 45 80 15 ''
-
- xbutton 0 60 80 15 ''
-
- xbutton 0 75 80 15 ''
-
- xbutton 0 90 80 15 ''
-
-
-
-
-
-
-